<?php


namespace app\admin\controller\inquiry;


use app\common\controller\Backend;
use think\facade\Db;

class Inquirylog extends Backend
{
    protected $noNeedLogin = ['index','detail','del'];
    protected $model = null;
//    protected $noNeedRight = ['check', 'rulelist'];

    public function initialize()
    {
        parent::initialize();
        $this->model =  Db::name('inquiry_log');
    }

    public function index(){

        if ($this->request->isAjax()) {
//            var_dump($_GET['ids']);die;
            [$where, $sort, $order, $offset, $limit] = $this->buildparams();
            $total = $this->model
                ->where($where)
//                ->where('inquiryid',$ids)
                ->order($sort, $order)
                ->count();
            $list = $this->model
//                ->where($where)
                ->order($sort, $order)
                ->limit($offset, $limit)
                ->select()->toArray();
//            echo $this->model -> getLastsql();

            $result = ['total' => $total, 'rows' => $list];
            return json($result);
        }
        return $this->fetch();
    }

}